#========================================================
#Created on 31/ago/2009
#
#@author: Fabio
#========================================================
from PyQt4 import QtCore, QtGui
from Gui.PlayerView import PlayerView

class MediaItem( QtGui.QLabel ):

    #========================================================
    # property mActive bool
    # Attiva il media per l'utilizzo
    #========================================================
    mActive = False
    def getActive( self ):  return self.__mActive
    def setActive( self ):  self.__mActive = True
    def delActive( self, value ):  pass

    mActive = property( getActive, setActive, delActive, "Attiva il media per l'utilizzo" )

    #========================================================
    # costruttore
    # 
    #========================================================   
    def __init__( self, name, x, y, parent ):
        super( MediaItem, self ).__init__( parent )

        mName = name
        self.setStatusTip( self.tr( "Trascina il media sulla stanza per poterlo utilizzare" ) )
        self.setPixmap( QtGui.QPixmap( ":" + mName + ".png" ).scaled( 32, 32 ) )
        self.setAttribute( QtCore.Qt.WA_DeleteOnClose )
        self.move( x, y )
        self.show()

    #========================================================
    # evento doppio click : apre finestra player
    # 
    #========================================================  
    def mouseDoubleClickEvent( self, *args, **kwrgs ):
        ply = PlayerForm()
        ply.setModal( True )
        ply.show()

